<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
</head>

<body style="color:#333;padding:3px;">
<!-- 标题 -->
<div class="page-heade">
    <h2 class="title_color text-center">渠道优惠政策</h2>
</div>
<!-- 标题 -->
<div class="form-inline">
    <form action="">
        <table class="row-margin-top tab-content table-bordered table" border="1">
            <tr>
                <td class="text-left" colspan="8" rowspan=""><a href="{:url('add')}"
                                                                class="btn btn-primary">新增渠道优惠政策申请</a></td>
            </tr>
            <tr>
                <td class="text-right"><label for="" class="form-label">编号：</label></td>
                <td><input type="text" class="form-control" name="sn" value="{$sn}"></td>
                <td class="text-right"><label for="">主题：</label></td>
                <td><input type="text" class="form-control" name="title" value="{$title}"></td>
                <td class="text-right"><label for="">状态：</label></td>
                <td>
                    <select name="status" id="" class="form-control">
                        <option value="">请选择</option>
                        <option value="1" {if $status==1}selected{/if} >草稿</option>
                        <option value="3" {if $status==3}selected{/if}>审批</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="text-right"><label for="" class="form-label">申请时间：</label>
                </td>
                <td colspan="5">
                    <div class="form-group">
                        <input type="text" id="start" class="form-control layer-date "
                               style="min-width:100px;width:100px;display: inline-block;" name="start" value="{$start}">
                    </div>
                    <div class="form-group">
                        至
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control layer-date"
                               style="min-width:100px;width:100px;display: inline-block;" id="end" name="end" value="{$end}">
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="6" class="text-center">
                    <button class="btn btn-info query">查询</button>
                    <button class="btn btn-info emptyIf" type="button">清空查询条件</button>
                </td>
            </tr>
        </table>

        <table class="table table-striped row-margin-top table-bordered text-center bud_hei">
            <tr class="info text-center">
                <th class="text-center">NO.</th>
                <th class="text-center">编号</th>
                <th class="text-center" style="min-width: 240px;width: 240px">主题</th>
                <th class="text-center">状态</th>
                <th class="text-center">是否撤销</th>
                <th class="text-center">申请人</th>
                <th class="text-center">申请时间</th>
                <th class="text-center">操作</th>
            </tr>
            {volist name="data" id="row" key="k"}
            <tr class="text-center">
                <td class="text-center">{$k+((request()->param('page')?request()->param('page'):1)-1)*10}</td>
                <td class="text-center"><a href="{:url('qpview')}?id={$row.id}" class="J_menuItem">{$row.sn}</a></td>
                <td class="text-center" style="min-width: 240px;width: 240px">{$row.title}</td>
                <td class="text-center">{$row.statustype}</td>
                <td class="text-center">{if $row.is_revoke}已撤销{else/}未撤销{/if}</td>
                <td class="text-center">{$row.sqr}</td>
                <td class="text-center">{$row.sqtime}</td>
                <td class="text-center">
                    {if $row.status==1}
                    <a href="{:url('update',['id'=>$row.id])}">修改</a>
                    <a href="javascript:;" data-link="{:url('delete',['id'=>$row.id])}" class="delete" data-id="{$row.id}">删除</a>
                    {/if}
                    {if $row.status==2}
                    <a href="{:url('update',['id'=>$row.id])}">作废/修改</a>
                    {/if}
                    {if $row.status!=1} <a href="{:url('Workflowdb/workflowchart',['id'=>$row.myId])}" class="J_menuItem" title="查看流程图">查看流程图</a>{/if}
                </td>
            </tr>
            {/volist}
        </table>
    </form>
</div>
<!-- 全局js -->
{include file="Public/footer"}
<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!--统计代码，可删除-->
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script>
    $('.emptyIf').on('click',function () {
        $(this).closest('form').find('input').val('')
        $(this).closest('form').find('select').val('')
        return false
    })

    $('.delete').on('click',function () {
        var link = $(this).data('link')
        var id = $(this).data('id')
        swal({
            title:'确定删除吗？',
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false
        },function (is) {
            if(is){
                $.post(link,{id:id},function (data) {
                    if(data.success){
                        swal({title:data.msg},function () {
                            location.reload()
                        })
                    }else{
                        swal(data.msg)
                    }
                },'json')
            }
        })

    })
    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD',
//        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY-MM-DD',
//        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
</script>
</body>

</html>
